package com.witframework.web.tag;


import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class IFrameTag extends BodyTagSupport{
  private String src = null;
  private String id = null;
  private String name = null;
  private String sBody = null;

  public void setId(String paramString)
  {
    this.id = paramString;
  }

  public String getId()
  {
    return this.id;
  }

  public void setSrc(String paramString)
  {
    this.src = paramString;
  }

  public String getSrc()
  {
    return this.src;
  }

  public void setName(String paramString)
  {
    this.name = paramString;
  }

  public String getName()
  {
    return this.name;
  }

  public int doAfterBody()
    throws JspException
  {
    BodyContent localBodyContent = getBodyContent();
    if (localBodyContent == null)
    {
      this.sBody = "";
    }
    else
    {
      if ((this.sBody = localBodyContent.getString()) == null)
        this.sBody = "";
      localBodyContent.clearBody();
    }
    return 0;
  }

  public int doEndTag()    throws JspException  {
    if (this.sBody == null)
      this.sBody = "";
    else
      this.sBody = this.sBody.trim();
    String str = "<iframe style=\"display:block;width:100%;height:100%;border:none;overflow-y:auto;overflow-x:hidden;\"";
    if (this.id != null)
      str = str + " id=\""+id+"\"";
    if (this.name != null)
      str = str + " name=\""+id+"\"";
    str = str + " src=\"" + this.src + "\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" width=\"100%\" height=\"100%\" scrolling=\"auto\"></iframe>";
    try
    {
      this.pageContext.getOut().write(str);
    }
    catch (Exception localException)
    {
      throw new JspException("Could not write data: " + localException.getMessage());
    }
    dropData();
    return 6;
  }

  public void release()
  {
    dropData();
  }

  private void dropData()
  {
    this.id = null;
    this.name = null;
    this.src = null;
    this.sBody = null;
  }
}